#include<bits/stdc++.h>
using namespace std;
namespace IO{
#define isDigit(x) ((x)>='0'&&(x)<='9')
template<typename T>
    inline void read(T&x){
        x=0;
        register char c=getchar();
        register bool fu=0;
        while(!isDigit(c)&&c!='-')
                c=getchar();
        if(c=='-')
            fu=1,c=getchar();
        while(isDigit(c))
            x=(x<<1)+(x<<3)+(c^48),c=getchar();
        if(fu==1)
            x=(~(x-1));
    }
    template<typename T>
    inline void _print(T x){
        if(x>9)
            _print(x/10);
        putchar((x%10)|48);
    }
    template<typename T>
    inline void print(T x){
        if(x<0)
            putchar('-'),
            _print((~(x-1)));
        else _print(x);
    }
}
using namespace IO;
int n,x,active;
map<int,pair<int,int> >a;//total : active
set<int>s;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    read(n);
    active=n;
    if(n<=2){
        putchar('1');
        return 0;
    }
    for(int i=1;i<=n;++i){
        read(x);
        ++a[x].first;
        ++a[x].second;
        s.insert(x);
    }
    a[*s.begin()].second=0;
    active-=a[*s.begin()].first;
    auto t1=s.begin();
    while(active){
        if(a[*t1].first==0){
            s.erase(t1);
            t1=s.begin();
            continue;
        }
        if(t1==s.end())break;
        auto t2=t1;++t2;
        if(t2==s.end())break;
        --a[*t1].first;
        --a[*t2].second;
        --active;
    }
    int ans=0;
    for(auto t:s)
        ans+=a[t].first;
    print(ans);
    fclose(stdin);
    fclose(stdout);
    return 0;
}
